<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
</head>

<body>
    <script>
        //把声明语句提升到作用域的最顶端
        // console.log(i);
        // var i = 10;
        // 经过变量声明提升 会变成如下
        // var i;
        // console.log(i);
        // i = 10;

        // console.log(i);
        // let i = 10;
        //报错

        var a = 20;
        console.log(window.a);
        //作为顶层属性 但是let和const不行

        // const num = 20;
        // num = 30;
        //报错
        const obj = {
            name: "小明",
        };
        obj.name = "小李";
        console.log(obj.name);
    </script>
</body>

</html>